<template>
  <div class="header-out">
    <div class="header">
      <div class="headerleft">
        <img src="@/assets/imageAdmin/logo.jpg" alt="">
        小森林圈
      </div>
      <div class="headerright">
        <el-input placeholder="搜索你感兴趣的内容标题" size="small" v-model="searchWord"></el-input>
        <span class="el-icon-search" @click="searchFn"></span>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'headerforum',
    data () {
      return {
        searchWord: ''
      }
    },
    created () {
    },
    methods: {
      searchFn () {
        console.log('path:', this.$route.path)
        if (this.$route.path !== '/forumlist') {
          if (!this.searchWord) {
            this.$message.error('请填写搜索内容')
            return
          }
          this.$router.push('/forumlist?type=search&&search=' + this.searchWord)
        } else {
          this.$emit('searchFn', this.searchWord)
        }
      }
    }
  }
</script>

<style scoped>

</style>
